/**
 * Definition for a binary tree node.
 * type TreeNode struct {
 *     Val int
 *     Left *TreeNode
 *     Right *TreeNode
 * }
 */
 // 递归
func sumOfLeftLeaves(root *TreeNode) int {
    sum := 0
    if root == nil {
        return sum
    }
    getLeftLeaveSum(root, &sum)
    return sum
}

func getLeftLeaveSum(node *TreeNode, sum *int) {
    if node.Left != nil && node.Left.Left == nil && node.Left.Right == nil {
        *sum = *sum + node.Left.Val
    }
    if node.Left != nil {
        getLeftLeaveSum(node.Left, sum)
    }
    if node.Right != nil {
        getLeftLeaveSum(node.Right, sum)
    }
}



